- expanded = discussion.expanded?
%li.note.note-discussion.timeline-entry.unstyled-comments
  .timeline-entry-inner
    .timeline-content
      .discussion.js-toggle-container{ data: { discussion_id: discussion.id, is_expanded: expanded.to_s } }
        .discussion-header.gl-display-flex.gl--flex-center
          .timeline-icon.gl-flex-shrink-0
            = link_to user_path(discussion.author) do
              = render Pajamas::AvatarComponent.new(discussion.author, size: 32, class: 'gl-mr-3')
          = link_to_member(@project, discussion.author, avatar: false)

          .inline.discussion-headline-light.gl-mx-3
            = discussion.author.to_reference
            started a thread

            - url = discussion_path(discussion)
            - if discussion.for_commit? && @noteable != discussion.noteable
              on
              - commit = discussion.noteable
              - if commit
                commit
                = link_to commit.short_id, url, class: 'commit-sha'
              - else
                a deleted commit
            - elsif discussion.diff_discussion?
              on
              = conditional_link_to url.present?, url do
                - if discussion.on_merge_request_commit?
                  - unless discussion.active?
                    an outdated change in
                  commit

                  %span.commit-sha= truncate_sha(discussion.commit_id)
                - else
                  - unless discussion.active?
                    an old version of
                  the diff

            = time_ago_with_tooltip(discussion.created_at, placement: "bottom", html_class: "note-created-ago")
          = render "discussions/headline", discussion: discussion

          .discussion-actions.gl-ml-auto
            %button.note-action-button.discussion-toggle-button.js-toggle-button{ type: "button", class: ("js-toggle-lazy-diff" unless expanded) }
              = sprite_icon('chevron-up', css_class: "js-sidebar-collapse #{'hidden' unless expanded}")
              = sprite_icon('chevron-down', css_class: "js-sidebar-expand #{'hidden' if expanded}")
              %span.js-sidebar-collapse{ class: "#{'hidden' unless expanded}" }= _('Hide thread')
              %span.js-sidebar-expand{ class: "#{'hidden' if expanded}" }= _('Show thread')

        .discussion-body.js-toggle-content{ class: ("hide" unless expanded) }
          - if discussion.diff_discussion? && discussion.diff_file
            = render "discussions/diff_with_notes", discussion: discussion
          - else
            .card
              = render partial: "discussions/notes", locals: { discussion: discussion, disable_collapse_class: true }
